if '__main__' == __name__:
    from PyCmpltrtok.common import sep

    N = 5

    path = r'D:\_dell7590_root\local\LNP_datasets\med\med_dialog\MedDialog_processed\MedDialog_processed\train_data.json'

    sep('lines')
    it = (line for line in open(path, 'r', encoding='utf8'))
    print('it:', it)

    for i, line in enumerate(it):
        n = i + 1
        if n > N:
            break
        print(n, f'|{line}|')

    sep('for line in it')
    it = (line for line in open(path, 'r', encoding='utf8'))
    it_len = ((len(line), line) for line in it)
    print('it_len:', it_len)
    for i, line in enumerate(it_len):
        n = i + 1
        if n > N:
            break
        print(n, f'|{line}|')

    sep('for line in (it)')
    it_len = ((len(line), line) for line in (line for line in open(path, 'r', encoding='utf8')))
    print('it_len:', it_len)
    for i, line in enumerate(it_len):
        n = i + 1
        if n > N:
            break
        print(n, f'|{line}|')
